package com.suli.account.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suli.account.entity.UserRole;
import com.suli.account.enums.UserType;
import com.suli.account.mapper.UserRoleMapper;
import com.suli.account.service.UserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SuLi
 * @since 2022-03-19
 */
@Service
@Transactional
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {

    @Autowired
    UserRoleMapper userRoleMapper;
    @Override
    public Map<String, Object> getAccountByType(String accountType) {
        QueryWrapper<UserRole> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("role_id", UserType.valueOf(accountType));
        Long aLong = userRoleMapper.selectCount(queryWrapper);
        Map<String,Object> map=new HashMap<>();
        map.put("AllCount", aLong);
        return map;
    }

}
